---
slug: index
description: Set default field values for Postgres in Hasura
keywords:
  - hasura
  - docs
  - postgres
  - schema
  - default value
---

# Postgres: Setting Default Values for Fields

Let's say you want certain fields to have their values set automatically when not explicitly passed. You can do this in
the following ways:

- [Postgres defaults](/schema/postgres/default-values/postgres-defaults.mdx): configure default values, using fixed
  values or simple SQL functions, for columns in the table definition. E.g. an auto-incrementing `id`, a `created_at`
  timestamp, etc.
- [Custom SQL functions](/schema/postgres/default-values/sql-functions.mdx): set up Postgres triggers which run custom
  SQL functions/stored procedures to set the values of certain columns on inserts/updates on the table. This is useful
  to set values of fields which depend on other fields passed in the input. e.g. set `submission_time` of an online quiz
  as 1 hour from the `start_time`.
- [Role based column presets](/schema/postgres/default-values/column-presets.mdx): set up presets, using session
  variables or fixed values, that are applied when a row is created/updated with a particular
  [user role](/auth/authorization/roles-variables.mdx). E.g. set a `user_id` field automatically from a session
  variable/authorization header.
- [Created_at / updated_at timestamps](/schema/postgres/default-values/created-updated-timestamps.mdx): set up
  `created_at` and `updated_at` timestamp values.
